package com.bolt.common.db.converts;

/**
 * Created by Administrator on 2020/7/28.
 */
public class PostgreSqlJdbcTypeConvert implements IJdbcTypeConvert {
    /**
     * <p>
     * 执行类型转换
     * </p>
     *
     * @param fieldType 字段类型
     * @return
     */
    @Override
    public JavaType processTypeConvert(String fieldType) {
        String t = fieldType.toLowerCase();
        if (t.contains("char") || t.contains("text")) {
            return JavaType.STRING;
        } else if (t.contains("bigint")) {
            return JavaType.LONG;
        } else if (t.contains("int")) {
            return JavaType.INTEGER;
        } else if (t.contains("date") || t.contains("time") || t.contains("year")) {
            return JavaType.DATE;
        } else if (t.contains("text")) {
            return JavaType.STRING;
        } else if (t.contains("bit")) {
            return JavaType.BOOLEAN;
        } else if (t.contains("decimal")) {
            return JavaType.BIG_DECIMAL;
        } else if (t.contains("clob")) {
            return JavaType.CLOB;
        } else if (t.contains("blob")) {
            return JavaType.BYTE_ARRAY;
        } else if (t.contains("float")) {
            return JavaType.FLOAT;
        } else if (t.contains("double")) {
            return JavaType.DOUBLE;
        } else if (t.contains("json") || t.contains("enum")) {
            return JavaType.STRING;
        } else if (t.contains("boolean")) {
            return JavaType.BOOLEAN;
        }
        return JavaType.STRING;
    }

}

 